home *** CD-ROM | disk | FTP | other *** search
/ Internet Standards / CD1.mdf / winsock / hacker / 93-11 / 000004_paul@atlas.dev.abccomp.oz.au_Wed Nov 24 05:16:22 1993.msg < prev    next >
Internet Message Format  |  1993-11-29  |  14KB

  1. Received: from usage.csd.unsw.OZ.AU by SunSITE.Unc.EDU (5.65c+IDA/FvK-1.06) with SMTP
  2.           id AA28916; Tue, 23 Nov 1993 18:16:23 -0500
  3. Received: by usage.csd.unsw.OZ.AU id AA02215
  4.   (5.65c/IDA-1.4.4 for winsock-hackers%sunsite.unc.edu); Wed, 24 Nov 1993 10:16:10 +1100
  5. Received: by atlas (4.1/1.35)
  6.     id AA25460; Wed, 24 Nov 93 10:16:23 EST
  7. Message-Id: <9311232316.AA25460@atlas>
  8. From: paul@atlas.abccomp.oz.au
  9. Date: Wed, 24 Nov 1993 10:16:22 -0500
  10. X-Mailer: Mail User's Shell (7.2.2 4/12/91)
  11. To: rcq@ftp.com, Multiple recipients of list <winsock-hackers@sunsite.unc.edu>
  12. Subject: Re: non-blocking lingering close
  13.  
  14. Thus expounded Bob Quinn on Nov 23, 3:50pm:
  15. /--------------------
  16. |Hi Paul!
  17. |
  18. |>  "violation of the API"? APIs are defined to be what is found to be useful,
  19. |>  and/or in this case largely compatible with BSD code. APIs aren't violated, 
  20. |>  they are defined.
  21. |
  22. |One of the great advantages of the Windows Sockets API is that
  23. |it hides low-level details.  APIs are indeed defined to be useful,
  24. |but simplicity has great benefits.  Exposing low-level details
  25. |complicates an API.
  26.  
  27. Agreed.
  28.  
  29. |  If its unnecessary, it's a violation.
  30.  
  31. Thats a bit strong, isn't it? If its unnecessary, its unnecessary, but it isn't broken, and simply "not using" an unnecessary feature is enough to shield you
  32. from the consequences. I guess I associate "violation" with phrases/words like
  33. "abomination", "blight on the planet", and other fire-and-brimstone concepts!
  34.  
  35. In an ideal API, every part in it is presumably defined because at least
  36. someone thought it necessary. That doesn't mean there aren't other features
  37. that are necessary, but no-one has thought of them yet. Not that I'm saying
  38. FIONWRITE is such a feature, of course!
  39.  
  40. It could be argued that send() and recv() are unnecessary (and hence
  41. "violations"), since exactly the same effect can be obtained using
  42. sendto() and recvfrom() with NULL address arguments.
  43.  
  44. |Detecting incoming data with FIONREAD is very different than
  45. |detecting incoming acknowledgments with FIONWRITE.
  46.  
  47. I didn't want to detect incoming ACKS - that is protocol-specific to TCP,
  48. and the sockets paradigm is not. I want to know the length of the outbound
  49. data queue, which is not, as far as I know, a concept specific to any
  50. stream protocol. For TCP, it is the sum of the data not-yet-sent and the length
  51. of the retransmission queue, but the application doesn't need or want to
  52. know how its calculated or stored.
  53.  
  54. |One side initiates the close of a TCP socket, not both.  If you
  55. |have called shutdown(how=1), it's valid to expect recv()=0 to
  56. |indicate the completion of a graceful close.  Otherwise you have
  57. |a seriously broken client/server pair.
  58.  
  59. Rubbish. Its perfectly possible for both sides to close their sending-side
  60. simultaneously, or at least before they are aware the other end has done so.
  61. Its not the common case, but its possible. In general, either side may shutdown
  62. their sending, to indicate "I won't send any more data". If the other
  63. end ever reciprocates (and its not guaranteed), yes you will get recv()=0
  64. eventually. If the other end has already closed its end, and is just accepting
  65. all the incoming data up to your FIN, you may well read the recv()=0 before
  66. the other end has accepted your outgoing data. In short, the world is not
  67. limited to using TCP in "client/server" pairs.
  68.  
  69. This has gotten a bit out of hand, Bob - lets take our religious differences
  70. to email, and concentrate on the technical issues here!
  71.  
  72. |
  73. |>  Am I correct that a closesocket() with linger set on (for a long time)
  74. |>  should block until the socket exits TIMEWAIT (if it is the first
  75. |>  FIN sender)?
  76. |
  77. |No.  And it doesn't matter what the timeout length is.  After 
  78. |initiating the close, a blocking closesocket() returns immediately 
  79. |after it receives the TCP <ACK><FIN>.  In other words, closesocket() 
  80. |returns at the point the TCP connection enters the TIMEWAIT state.
  81. |
  82. |The socket is invalid after the return from closesocket().  But if 
  83. |it just completed a graceful close (that it initiated), the TCP 
  84. |connection still has some life to it.  It can send another <ACK> 
  85. |if the other side missed the first one and sends another <FIN>.  
  86. |The port used cannot be bound by another socket until this TIMEWAIT 
  87. |state expires.
  88.  
  89. Oh! I have been assuming that a blocking lingering closesocket() must block
  90. until the socket is fully closed (i.e. right through TIMEWAIT), because
  91. only then can you bind() another socket to the same port (without setting
  92. SO_REUSEADDR). There are certainly many points in Jim Gilroy's WSAT
  93. scripts where he assumes you can create an identical TCP connection
  94. (same addresses/ports) immediately after closesocket() returns.
  95.  
  96. How is this different, then, from a non-blocking graceful closesocket()?
  97. At least in the non-blocking graceful close your data will be correctly sent
  98. if possible, no matter how long it takes, whereas with the blocking graceful
  99. close you have no guarantee your data will be sent, because of the possibility
  100. of the timeout occuring.
  101.  
  102. >From an application's point of view, picking a timeout value applicable
  103. for all the different possiblities of remote host speeds and path speeds that
  104. might occur, so that the application works well over ethernet or 300 baud
  105. packet radio and still closes connections off in a timely manner without
  106. aborting the close process prematurely, is fraught with difficulty, and offends
  107. me more than being able to find out the amount of outstanding data (which
  108. BTW could be used to judge the average link speed, and hence allow more
  109. sensible timeout values for blocking closesocket()s to be chosen!).
  110.  
  111. Bob, any thoughts on the other message I sent, about matching incoming
  112. SYN packets with aborted connections?
  113.  
  114.  
  115. -- 
  116. Paul Brooks              |paul@abccomp.oz.au       |Emerging Standard:
  117. TurboSoft Pty Ltd        |pwb@newt.phys.unsw.edu.au|  one that has not yet
  118. 579 Harris St., Ultimo   |                         |  been superseded.
  119. Sydney Australia 2007    |ph: +61 2 281 3155       |  
  120. From paul@atlas.dev.abccomp.oz.au Tue Nov 30 11:30:36 1993
  121. Received: from usage.csd.unsw.OZ.AU by SunSITE.Unc.EDU (5.65c+IDA/FvK-1.06) with SMTP
  122.           id AA04606; Tue, 30 Nov 1993 03:02:44 -0500
  123. Received: by usage.csd.unsw.OZ.AU id AA27113
  124.   (5.65c/IDA-1.4.4 for winsock-hackers%sunsite.unc.edu); Tue, 30 Nov 1993 16:20:20 +1100
  125. Received: by atlas (4.1/1.35)
  126.     id AA13318; Tue, 30 Nov 93 16:30:36 EST
  127. Message-Id: <9311300530.AA13318@atlas>
  128. From: paul@atlas.abccomp.oz.au
  129. Date: Tue, 30 Nov 1993 16:30:36 -0500
  130. X-Mailer: Mail User's Shell (7.2.2 4/12/91)
  131. To: winsock-hackers@sunsite.unc.edu
  132. Subject: newsgroup -> email gateway problems?
  133.  
  134. I am seeing many more messages inthe alt.winsock newsgroup than I am from
  135. the winsock mailing lists - messages seem to be gated form the mailing list to
  136. the newsgroup OK, but news postings don't seem to be gated back to
  137. the mailing list. Has anyone else noticed this?
  138.  
  139.  
  140. -- 
  141. Paul Brooks              |paul@abccomp.oz.au       |Emerging Standard:
  142. TurboSoft Pty Ltd        |pwb@newt.phys.unsw.edu.au|  one that has not yet
  143. 579 Harris St., Ultimo   |                         |  been superseded.
  144. Sydney Australia 2007    |ph: +61 2 281 3155       |  
  145. From paul@atlas.dev.abccomp.oz.au Tue Nov 30 11:28:24 1993
  146. Received: from usage.csd.unsw.OZ.AU by SunSITE.Unc.EDU (5.65c+IDA/FvK-1.06) with SMTP
  147.           id AA04634; Tue, 30 Nov 1993 03:03:09 -0500
  148. Received: by usage.csd.unsw.OZ.AU id AA27019
  149.   (5.65c/IDA-1.4.4 for winsock-hackers%sunsite.unc.edu); Tue, 30 Nov 1993 16:18:14 +1100
  150. Received: by atlas (4.1/1.35)
  151.     id AA13300; Tue, 30 Nov 93 16:28:24 EST
  152. Message-Id: <9311300528.AA13300@atlas>
  153. From: paul@atlas.abccomp.oz.au
  154. Date: Tue, 30 Nov 1993 16:28:24 -0500
  155. X-Mailer: Mail User's Shell (7.2.2 4/12/91)
  156. To: winsock-hackers@sunsite.unc.edu
  157. Subject: Multiple connect()s with SOCK_DGRAM sockets?
  158.  
  159. What is the feeling of the community in allowing multiple connect() calls
  160. on SOCK_DGRAM sockets? I have several conflicting points either way:
  161.  
  162. 1)    The Winsock 1.1 manual does not mention the possibility of calling
  163.     connect() again to change the desired destination endpoint on UDP
  164.     sockets.
  165.  
  166. 2)    My Sun's man-page for connect() indicates that a SOCK_DGRAM socket can
  167.     be "un-connected" by calling connect() with an invalid address -
  168.     presumably you can then call connect() with a different valid address.
  169.  
  170. 3)    Jim's WSAT scripts seem to want to do exactly this, using a destination
  171.     sockaddr_in with all fields, including sin_family, set to 0. The Winsock
  172.     spec. should fail these calls with WSAEAFNOSUPPORT, although Jim
  173.     assumes they will succeed.
  174.  
  175. 4)    Doing the same thing on the Sun (all fields, including family, 0)
  176.     caused that connect() call to core dump !
  177.  
  178. 5)    Douglas Comer, in "Internetworking with TCP/IP Vol. 3", section 8.17,
  179.     says that once a UDP socket is connect()ed, it can never again be used
  180.     to receive datagrams from arbitrary clients - it can never be
  181.     un-connected.
  182.  
  183. Since I've been informed more than once that the aim is "BSD compatibility",
  184. and if the Winsock spec differs from BSD behaviour, the BSD behaviour is what
  185. should be followed, I would like to propose some standard behaviour for
  186. Windows Sockets implementations, possibly with appropriate text added to the
  187. next specification, or any addendum to the current spec. (Wasn't there going
  188. to be a document with examples and explanations of some points, for those of
  189. us unable to get to the winsock-a-thons for the FD_CLOSE wars and similar?)
  190.  
  191. 1)    A connected SOCK_DGRAM socket can be "dis-connected" by calling
  192.     connect() again with a destination 'name' consisting of address and
  193.     port containing all zeros, and a valid family for the socket
  194.     (i.e. "AF_INET / 0 / 0.0.0.0").
  195.  
  196. 2)    A connected SOCK_DGRAM must be dis-connected using this method before
  197.     it can be re-connected again, to the same or different destination
  198.     address, otherwise an error code of WSAEISCONN will be returned
  199.     (just like should happen now).
  200.  
  201.  
  202. This should retain full compatibility both with the current specification and
  203. with BSD sockets.
  204.  
  205. Comments anyone? I would really like to hear how the various implementations
  206. currently behave in this regard, and what everyone thinks is a reasonable
  207. interpretation of the 5 conflicting points listed above.
  208.  
  209.  
  210. -- 
  211. Paul Brooks              |paul@abccomp.oz.au       |Emerging Standard:
  212. TurboSoft Pty Ltd        |pwb@newt.phys.unsw.edu.au|  one that has not yet
  213. 579 Harris St., Ultimo   |                         |  been superseded.
  214. Sydney Australia 2007    |ph: +61 2 281 3155       |  
  215. From rrealmut@b30po1.pcmail.ingr.com Tue Nov 30 00:58:00 1993
  216. Received: from pcout.pcmail.ingr.com by SunSITE.Unc.EDU (5.65c+IDA/FvK-1.06) with SMTP
  217.           id AA28635; Tue, 30 Nov 1993 09:58:01 -0500
  218. Received: from hubsmp2.pcmail.ingr.com by pcout.pcmail.ingr.com (5.65c/1.921207)
  219.     id AA01726; Tue, 30 Nov 1993 08:59:12 -0600
  220. Received: by hubsmp2.pcmail.ingr.com with Microsoft Mail
  221.     id <2CFB7BD4@hubsmp2.pcmail.ingr.com>; Tue, 30 Nov 93 08:59:00 PST
  222. From: "Realmuto, Rob" <rrealmut@b30po1.pcmail.ingr.com>
  223. To: "'SMTP:paul@abccomp.oz.au'" <paul@abccomp.oz.au>,
  224.         winsock-hackers <winsock-hackers@SunSITE.Unc.EDU>
  225. Subject: RE: newsgroup -> email gateway problems?
  226. Date: Tue, 30 Nov 93 08:58:00 PST
  227. Message-Id: <2CFB7BD4@hubsmp2.pcmail.ingr.com>
  228. Encoding: 29 TEXT
  229. X-Mailer: Microsoft Mail V3.0
  230.  
  231.  
  232. I've seen the same thing.
  233.  
  234.  ---------------------------------------------------------------------
  235.      Rob Realmuto        |  Mail Stop: GD1103
  236.      Columbus  Lab       |  E-mail:rrealmut@ingr.com or
  237.      Intergraph Corporation   |rrealmut@b30po1.pcmail.ingr.com
  238.      Huntsville, Alabama      |  Telephone: (205) 730-6475
  239.     35894-0000      FAX: (205) 730-6000
  240.  ---------------------------------------------------------------------
  241.  ----------
  242. >From: winsock-hackers
  243. >To: Multiple recipients of list
  244. >Subject: newsgroup -> email gateway problems?
  245. >Date: Tuesday, November 30, 1993 3:14AM
  246. >
  247. >I am seeing many more messages inthe alt.winsock newsgroup than I am from
  248. >the winsock mailing lists - messages seem to be gated form the mailing list 
  249. to
  250. >the newsgroup OK, but news postings don't seem to be gated back to
  251. >the mailing list. Has anyone else noticed this?
  252. >
  253. >
  254. >--
  255. >Paul Brooks              |paul@abccomp.oz.au       |Emerging Standard:
  256. >TurboSoft Pty Ltd        |pwb@newt.phys.unsw.edu.au|  one that has not yet
  257. >579 Harris St., Ultimo   |                         |  been superseded.
  258. >Sydney Australia 2007    |ph: +61 2 281 3155       |
  259. >
  260. From jskohl@srv.pacbell.com Tue Nov 30 00:29:33 1993
  261. Received: from ns.PacBell.COM by SunSITE.Unc.EDU (5.65c+IDA/FvK-1.06) with SMTP
  262.           id AA08514; Tue, 30 Nov 1993 11:32:33 -0500
  263. Received: from srv.PacBell.COM (mother.srv.PacBell.COM) by ns.PacBell.COM (4.1/PacBell-10/26/93)
  264.     id AA23941; Tue, 30 Nov 93 08:32:31 PST
  265. Received: from sbhp1.srv.pacbell.com by srv.PacBell.COM (4.1/SMI-4.0)
  266.     id AA21591; Tue, 30 Nov 93 08:32:30 PST
  267. Received: by sbhp1.srv.pacbell.com
  268.     (1.37.109.4/16.2) id AA16986; Tue, 30 Nov 93 08:29:33 -0800
  269. From: Jeff Kohl <jskohl@srv.pacbell.com>
  270. Message-Id: <9311301629.AA16986@sbhp1.srv.pacbell.com>
  271. Subject: unsubscribe
  272. To: winsock-hackers@sunsite.unc.edu
  273. Date: Tue, 30 Nov 93 8:29:33 PST
  274. X-Hpvue$Revision: 1.8 $
  275. Mime-Version: 1.0
  276. Content-Type: Message/rfc822
  277. X-Vue-Mime-Level: 4
  278. Mailer: Elm [revision: 70.85]
  279.  
  280. content-type:text/plain;charset=us-ascii
  281. mime-version:1.0
  282.  
  283. Please unsubscribe me
  284.